package com.cskaoyan.javase.oop1._13block._1building.exercise;

/**
 * 读程序题
 * @since 09:32
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    // 静态成员变量的显式赋值,在类加载过程中执行
    static Cat c = new Cat();
    public static void main(String[] args) {
        System.out.println("main方法启动~");
        Cat c = new Cat(28, "紫色");
        System.out.println(c.age);
        System.out.println(c.color);
    }
}
class Cat {
    // 静态成员变量的显式赋值,在类加载过程中执行
    static Dog d = new Dog();
    {
        age = 18;
        System.out.println("age building block");
    }
    int age = 10;
    String color = "黄色";
    {
        color = "黑色";
        System.out.println("color building block");
    }
    public Cat() {
    }
    public Cat(int age) {
        System.out.println("age constructor");
        this.age = age;
    }

    public Cat(int age, String color) {
        this(age);
        System.out.println("age color constructor");
        this.color = color;
    }
}
class Dog{
    // 静态成员变量的显式赋值,在类加载过程中执行
    static int num = 10;
    public Dog() {
        System.out.println("dog");
    }
}